﻿using System;
using System.Collections.Generic;
using System.Text;

namespace System {
	/// <summary>
	/// Event args
	/// </summary>
	public class PackageValueChangingEventArgs : EventArgs {
		#region Fields
		private readonly PackageProperty _property;
		private readonly PackageBase _source;

		private readonly Object _oldValue;
		private readonly Object _newValue;

		private Boolean _cancel;
		#endregion
		#region Constructor
		/// <summary>
		/// Initializes a new instance of the <see cref="PackageValueChangingEventArgs"/> class.
		/// </summary>
		public PackageValueChangingEventArgs() {

		}
		/// <summary>
		/// Initializes a new instance of the <see cref="PackageValueChangingEventArgs"/> class.
		/// </summary>
		/// <param name="source">The source.</param>
		/// <param name="property">The property.</param>
		/// <param name="oldValue">The old value.</param>
		/// <param name="newValue">The new value.</param>
		public PackageValueChangingEventArgs(PackageBase source, PackageProperty property, Object oldValue,Object newValue) {
			_source = source;
			_property = property;
			_oldValue = oldValue;
			_newValue = newValue;
		}
		#endregion
		#region Public
		/// <summary>
		/// Returns a <see cref="System.String"/> that represents this instance.
		/// </summary>
		/// <returns>
		/// A <see cref="System.String"/> that represents this instance.
		/// </returns>
		public override string ToString() {
			return this.Property.ToString();
		}
		#endregion
		#region Property
		/// <summary>
		/// Gets the property.
		/// </summary>
		/// <value>The property.</value>
		public PackageProperty Property {
			get {
				return _property;
			}
		}
		/// <summary>
		/// Gets the new value.
		/// </summary>
		/// <value>The new value.</value>
		public Object NewValue {
			get {
				return _newValue;
			}
		}
		/// <summary>
		/// Gets the old value.
		/// </summary>
		/// <value>The old value.</value>
		public Object OldValue {
			get {
				return _oldValue;
			}
		}
		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="PackageValueChangingEventArgs"/> should cancel.
		/// </summary>
		/// <value><c>true</c> should cancel; otherwise, <c>false</c>.</value>
		public Boolean Cancel {
			get {
				return _cancel;
			}
			set {
				_cancel = value;
			}
		}
		/// <summary>
		/// Gets the source.
		/// </summary>
		/// <value>The source.</value>
		public PackageBase Source {
			get {
				return _source;
			}
		}
		#endregion
	}
}
